● Zion Boggan
repos/Docket/app/api/bills/[id]/route.ts
zionboggan.com ↗
16 lines · typescript
History for this file →
1
import { NextResponse, type NextRequest } from "next/server";
2
import { getBillDetail } from "@/lib/feed";
3
 
4
export const dynamic = "force-dynamic";
5
 
6
export async function GET(
7
  _req: NextRequest,
8
  { params }: { params: { id: string } }
9
) {
10
  const numeric = parseInt(params.id.replace(/^bill:/, ""), 10);
11
  const bill = Number.isFinite(numeric) ? getBillDetail(numeric) : null;
12
  if (!bill) {
13
    return NextResponse.json({ error: "not found" }, { status: 404 });
14
  }
15
  return NextResponse.json(bill);
16
}